package jp.co.sharp.android.parents.kidsguard.activity.sendImage;

import android.content.ContentResolver;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import java.io.FileNotFoundException;
import java.io.InputStream;

import jp.co.sharp.android.parents.kidsguard.R;
import jp.co.sharp.android.parents.kidsguard.activity.home.HomeActivity;
import jp.co.sharp.android.parents.kidsguard.activity.sendImage.dialog.PreviewDlg;

public class ImageCutActivity extends AppCompatActivity {

    private String imagePath;

    private static final int REQUEST_IMAGE_CUT = 100;

    private CorpToView corpToView;

    private static final int REQUEST_IMAGE_CUT_BACK = 200;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_iamge_cut);
        Intent intent = getIntent();
        imagePath = intent.getStringExtra("imagePath");
        corpToView=(CorpToView)findViewById(R.id.corpToView);
        corpToView.showImage(imagePath);

    }

    public void rotate90(View view) {
        corpToView.rotate90();
    }

    public void cut(View view) {
        corpToView.getClipRectImage();
        finish();
    }

    public void backToHome(View view){
        Intent intent = getIntent();
        setResult(REQUEST_IMAGE_CUT_BACK, intent);
        finish();
    }

}
